#include "State.h"
#include "Actor.h"


void CStateIdle::Enter()
{
	// Set actor to idle animation.
	pActor->pActiveAnimation = &pActor->animIdle;

	// Set actor's chart
	pActor->dxcFlow.SetAnchor(CHART_IDLE);

	// Log the Enter() in the Actor's message queue
	pActor->messageQueue.push_front("CStateIdle::Enter()");
	messageTimer.Set(MESSAGE_FREQUENCY);
}

bool CStateIdle::Update()
{
	pActor->pActiveAnimation->Update();

	if(messageTimer.Check())
	{	
		// Log the Update() in the Actor's message queue
		pActor->messageQueue.push_front("CStateIdle::Update()");
		messageTimer.Set(MESSAGE_FREQUENCY);
	}

	// State update successful...
	return true;
}

void CStateIdle::Exit()
{
	// Log the Exit() in the Actor's message queue
	pActor->messageQueue.push_front("CStateIdle::Exit()");
}
